﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using VirtuOS.Base;

namespace VirtuOS.Components.Commands
{
    class rename
    {
        public static string help = "Renames the specified file.";
        public static string register_name = @"^ren(ame)?$";
        public static bool requires_root = false;

        public static void Command(string[] args)
        {
            if ((args.Length > 0) && (Regex.Match(args[0], @"(-)?-help", RegexOptions.IgnoreCase).Success))
            {
                Console.WriteLine(help);
            }
            else
            {
                if ((args.Length > 1) && (args[0] != null) && (args[1] != null))
                {
                    FileHandler.Rename(args[0], args[1]);
                }
            }
        }
    }
}
